<?php

header('Content-Type: text/plain; charset=utf-8');

$sec = 30;
$act = "IDENTIFY";
$url = "http://localhost/ingria/demo/common/call.php?act=".$act;
$url = "http://localhost/ingria/demo/common/call.php?act=identify&phone=5555&timeout=1";

try
{
	$ch = curl_init();  
	curl_setopt($ch, CURLOPT_URL, $url); // set url to post to  
	curl_setopt($ch, CURLOPT_FAILONERROR, 1);  
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects  
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable  
	curl_setopt($ch, CURLOPT_TIMEOUT, $sec); // times out after 4s  
	curl_setopt($ch, CURLOPT_POST, 0); // set POST method  
	//curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL"); // add POST fields  
	$result = curl_exec($ch); // run the whole process  
	curl_close($ch);   

	$json = json_decode($result, true);
	print_r($json);
	print_r($json['CODE']);
}
catch(Exception $e)
{
	echo $e->get_message();
}